package data
{
    import com.reintroducing.sound.SoundManager;
    
    import flash.display.Sprite;
    
    public class Map extends Sprite
    {
        private static const _GAP:int = 40;
        private static var _level:uint = 0;
		/**
		 *定义地图数组 
		 */		
        private static var _allMaps:Array = new Array();

        // 地图对象设定值
		/**
		 * 地板格子
		 */		
        public static var E_Floor:int = 0; 
		/**
		 * 青草堆障碍物(可炸毁,可隐藏)
		 */		
        public static var E_GrassHinder:int = 1; 
		/**
		 * 箱子障碍物(可炸毁，可推动)
		 */		
        public static var E_BoxHinder:int = 2; 
		/**
		 * 黄色房子障碍物(不可炸毁)
		 */		
        public static var E_YellowHouseHinder:int = 3; 
		/**
		 *蓝色房子障碍物(不可炸毁) 
		 */		
        public static var E_BlueHouseHinder:int = 4; 
		/**
		 * 红色房子障碍物(不可炸毁)
		 */		
        public static var E_RedHouseHinder:int = 5; 
		/**
		 * 黄色墩子障碍物(可炸毁)
		 */		
        public static var E_YellowWoodHinder:int = 6; 
		/**
		 * 红色墩子障碍物(可炸毁)
		 */		
        public static var E_RedWoodHinder:int = 7; 
		/**
		 * 大树障碍物(不可炸毁)
		 */		
        public static var E_TreeHinder:int = 8; 
		/**
		 * 石头障碍物(不可炸毁)
		 */		
        public static var E_StoneHinder:int = 9; 
		/**
		 * 泡泡 
		 */		
        public static var E_Paopao:int = 10; 

        _allMaps[0] = [
            [0,1,0,0,0,1,8,1,8,1,0,0,0,1,0],
            [1,3,0,7,7,1,1,1,1,1,7,7,0,3,1],
            [0,0,7,0,0,7,0,0,0,7,0,0,7,0,0],
            [0,7,0,0,2,0,7,0,7,0,2,0,0,7,0],
            [0,7,0,2,0,2,0,7,0,2,0,2,0,7,0],
            [0,7,0,0,6,0,0,0,0,0,6,0,0,7,0],
            [2,0,7,0,0,6,6,6,6,6,0,0,7,0,2],
            [0,2,0,7,0,0,6,6,6,0,0,7,0,2,0],
            [8,0,2,0,7,0,0,9,0,0,7,0,2,0,8],
            [0,5,1,5,0,7,0,0,0,7,0,4,1,4,0],
            [0,1,1,1,0,0,7,0,7,0,0,1,1,1,0],
            [1,5,1,5,0,2,0,7,0,2,0,4,1,4,1],
            [0,1,0,0,0,1,0,0,0,1,0,0,0,1,0]
        ];//15*13
        
        public static function set level(v:uint):void
        {
            _level = v;
        }
        
        public static function get data():Array
        {
            return _allMaps[_level];
        }
        
        public static function get col():int
        {
            return _allMaps[_level][0].length;
        }
        
        public static function get row():int
        {
            return _allMaps[_level].length;
        }
        
        public static function get GAP():int
        {
            return _GAP;
        }
		
        public static function finderName(finderID:int):String
        {
            switch (finderID) {
                case E_Floor: return "Floor";
                case E_GrassHinder: return "GrassHinder";
                case E_BoxHinder: return "BoxHinder";
                case E_YellowHouseHinder: return "YellowHouseHinder";
                case E_BlueHouseHinder: return "BlueHouseHinder";
                case E_RedHouseHinder: return "RedHouseHinder";
                case E_YellowWoodHinder: return "YellowWoodHinder";
                case E_RedWoodHinder: return "RedWoodHinder";
                case E_TreeHinder: return "Tree";
                // others: 道具
            }
            return "unknown";
        }
        
        public static function finderBombed(finderID:int):Boolean
        {
            switch (finderID) {
                case E_YellowHouseHinder:
                case E_BlueHouseHinder:
                case E_RedHouseHinder:
                case E_TreeHinder: 
                    return false;
                default: 
                    return true;
            }
            
            return true;
        }
    }
}
